#include "epollserver.hpp"
#include "error.hpp"

#include <iostream>
#include <memory>

void Usage(std::string arg)
{
    std::cout << "\n Usage: \n\t" << arg << " port"
              << "\n\t" << std::endl;
}

std::string recvFrom(const std::string &str)
{
    return "client# " + str;
}

// ./epollserver 8080
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    std::unique_ptr<Server::epollServer> upse(new Server::epollServer(recvFrom, atoi(argv[1])));

    upse->InitServer();
    upse->Start();
    return 0;
}